<template>
	<view>
		<view class="userList">
			<navigator url="../teacher/infobase" class="userLine">
				<view class="userLine" style="margin-top: 2rpx;">
					<image :src="mephoto" class="userLogo" mode="aspectFit"></image>
					<view style="margin-left: 30rpx;">
						<view style="font-size: 34rpx;">{{ teachername }}</view>
						<view style="color: #888888; font-size: 28rpx;">教师号：{{ teacherdataid }}</view>
					</view>
				</view>
				<uni-icons type="arrowright" size="20" color="#B6B3B2"></uni-icons>
			</navigator>
		</view>
		<view class="menu">
			<view class="menuBox">
				<navigator url="./about/about" >
					<image src="/static/images/3.png" mode="" class="menuCover"></image>
				</navigator>
				<text>我的学生</text>
			</view>
			<view class="menuBox">
				<navigator url="./about/about" >
					<image src="/static/images/3.png" mode="" class="menuCover"></image>
				</navigator>
				<text>我的课程</text>
			</view>
			<view class="menuBox">
				<navigator url="./about/about" >
					<image src="/static/images/3.png" mode="" class="menuCover"></image>
				</navigator>
				<text>我的作业</text>
			</view>
		</view>
		<view class="itemList">
			<navigator url="./about/about" class="itemLine">
				<text>关于我们</text>
				<uni-icons type="arrowright" size="20" color="#B6B3B2"></uni-icons>
			</navigator>
		</view>
	</view>
</template>

<script>
// 引入图标组件
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
// 引入API
import { _config } from '@/config.js'
export default {
	components: { uniIcons },
	data() {
		return {
			file_host : _config.FILE_HOST, /* 文件服务器 */
			teacherdataid: '',
			teachername: '',
			gwuserid:'未知',
			mephoto:'../../static/images/mephoto.jpg',
		};
	},
	onLoad() {
		let token = uni.getStorageSync('token');
		if(!token) {
			this.login();
		}
	},
	onShow() {
		let token = uni.getStorageSync('token');
		if(!token) {
			this.login();
		}
		else{
			this.getTeacherInfo();
		}
	},
	methods: {
		login(){
			uni.navigateTo({
				url: '/pages/login/login?back=1'
			});
		},
		goMenu: function(action) {
			// 效验是否登录
			if (!this.$_global.checkLogin()) {
				return;
			}
			switch(action) {
				case 1:
					uni.navigateTo({
						url: './package/package?index=0'
					});
					break;
				case 2:
					uni.navigateTo({
						url: './address/address'
					});
					break;
			}
		},
		getTeacherInfo: function() {
			this.teacherdataid = uni.getStorageSync("teacherdataid");
			this.teachername = uni.getStorageSync("teachername");
		},
		
	}
};
</script>

<style>
.userList {
	display: flex;
	flex-direction: column;
	margin-top: 50rpx;
}
.userList .userLine {
	display: flex;
	justify-content: space-between;
	border-bottom: 2px solid #efefef;
	height: 200rpx;
	align-items: center;
	padding: 0 20rpx;
}
.userLogo {
	width: 150rpx;
	height: 150rpx;
	background-color: #F0F0F0;
	margin-left: 10rpx;
	border-radius: 20rpx;
}
.userName{
	display: flex;
}
.userInfo .userInfoRight {
	margin-left: 20rpx;
}
.menu {
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
	flex-wrap: wrap;
	margin: 20rpx 0;
	margin-top: 80rpx;
}
.menu .menuBox {
	width: 33%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}
.menu .menuBox text {
	font-size: 26rpx;
	margin-top: 10rpx;
}
.menu .menuCover {
	width: 80rpx;
	height: 80rpx;
}
.itemList {
	margin-top: 50rpx;
	display: flex;
	flex-direction: column;
}
.itemList .itemLine {
	display: flex;
	justify-content: space-between;
	border-bottom: 1px solid #efefef;
	height: 120rpx;
	align-items: center;
	padding: 0 20rpx;
}
.itemList .lineImg {
	width: 50rpx;
	height: 50rpx;
}
</style>
